package com.sright.bcard.enterprise.web.controller;
import com.sright.bcard.common.service.share.enums.SourceTypeEnum;
import com.sright.bcard.common.share.service.ContentCheckService;

import com.sright.common.response.SrightResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

/**
 *
 */
@RestController
@RequestMapping("/common")
public class CommonController extends BaseController{

    @Autowired
    private ContentCheckService contentCheckService;

    /**
     * 敏感词审核
     * @param content
     * @return
     */
    @GetMapping("/textCheck.json")
    public SrightResponse textCheck(@RequestParam("content") String content) {
        List<String > list = new LinkedList<>();
        list.add(content);
        return SrightResponse.defaultSuccess(contentCheckService.textCheck(list,userContext.getEnterpriseId(), SourceTypeEnum.ENTERPRISE_BACKEND.getValue()));
    }

    /**
     * 视频审核结果回调
     * @param param
     * @return
     */
    @PostMapping("/contentCheckCallback.json")
    public SrightResponse contentCheckCallback(@RequestParam Map<String, Object> param) {
        return contentCheckService.callback(param);
    }
}
